<ui:composition template="/WEB-INF/template/layoutPadrao.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="titulo">Novo Material</ui:define>

	<f:metadata>
		<f:viewParam name="material" value="#{cadastroMaterialBean.material}" />
	</f:metadata>

	<ui:define name="corpo">
		<h:form>
			<h1>Novo Material</h1>
			<p:messages autoUpdate="true" closable="true" />

			<p:toolbar style="margin-top:20px">
				<p:toolbarGroup>
					<p:button value="Novo" outcome="/material/cadastroMaterial" />
					<p:commandButton value="Salvar" id="botaoSalvar"
						action="#{cadastroMaterialBean.salvar}" update="@form" />
				</p:toolbarGroup>

				<p:toolbarGroup align="right">
					<p:button value="Pesquisa" outcome="/material/pesquisaMaterial" />
				</p:toolbarGroup>
			</p:toolbar>

			<p:panelGrid columns="4" id="painel"
				style="width:100%; margin-top:20px" columnClasses="rotulo, campo">

				<p:outputLabel value="Tombamento CEFET" for="cefet" />
				<p:inputMask id="cefet" mask="999999"
					value="#{cadastroMaterialBean.material.tombCefet}" />

				<p:outputLabel value="Tombamento IFRR" for="ifrr" />
				<p:inputMask id="ifrr" mask="999999"
					value="#{cadastroMaterialBean.material.tombIfrr}" />


				<p:outputLabel value="Estado" for="estado" />
				<p:selectOneMenu id="estado"
					value="#{cadastroMaterialBean.material.estado}">
					<f:selectItem itemLabel=":: Selecione ::" />
					<f:selectItems value="#{cadastroMaterialBean.tipoEstados}"
						var="tipo" itemValue="#{tipo}" itemLabel="#{tipo}" />
				</p:selectOneMenu>

				<p:outputLabel value="Grupo" for="grupo" />
				<p:autoComplete id="grupo" size="60" dropdown="true"
					value="#{cadastroMaterialBean.material.grupo}"
					completeMethod="#{cadastroMaterialBean.completarGrupo}"
					forceSelection="true" var="grupo" itemValue="#{grupo}"
					itemLabel="#{grupo.nomeGrupo}" />


				<p:outputLabel value="Especifição" for="espec" />
				<p:inputTextarea rows="5" style="width:100%" id="espec"
					value="#{cadastroMaterialBean.material.especificacao}" />

				<p:outputLabel value="Valor do Bem" for="valorBem" />
				<p:inputText id="valorBem" size="10" maxlength="100"
					styleClass="moeda"
					value="#{cadastroMaterialBean.material.valorBem}">
					<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
				</p:inputText>

				<p:outputLabel value="Setor" for="setor" />
				<p:autoComplete id="setor" size="30" dropdown="true"
					value="#{cadastroMaterialBean.material.gestor}"
					completeMethod="#{cadastroMaterialBean.completarSetor}"
					forceSelection="true" var="gestor" itemValue="#{gestor}"
					itemLabel="#{gestor.setor}" />

				<p:outputLabel value="Empenho" for="empenho" />
				<p:autoComplete id="empenho" size="30" dropdown="true"
					value="#{cadastroMaterialBean.material.empenho}"
					completeMethod="#{cadastroMaterialBean.completarEmpenho}"
					forceSelection="true" var="empenho" itemValue="#{empenho}"
					itemLabel="#{empenho.empenhoNumero}" />

				<p:outputLabel value="Nota Fical" for="fiscal" />
				<p:inputText id="fiscal" size="30" maxlength="30"
					value="#{cadastroMaterialBean.material.nf}" />

				<p:outputLabel value="Empresa" for="empresa" />
				<p:autoComplete id="empresa" size="80" dropdown="true"
					value="#{cadastroMaterialBean.material.empresa}"
					completeMethod="#{cadastroMaterialBean.completarEmpresa}"
					forceSelection="true" var="empresa" itemValue="#{empresa}"
					itemLabel="#{empresa.nome}" />

				<p:outputLabel value="Data do Atesto NF" for="dataCompra" />
				<p:calendar size="10" id="dataCompra" pattern="dd/MM/yyyy"
					value="#{cadastroMaterialBean.material.dataCompra}"  effect="explode"/>

				<p:outputLabel value="Observação" for="obs" />
				<p:inputText id="obs" size="85"
					value="#{cadastroMaterialBean.material.obs}" />
			</p:panelGrid>


		</h:form>
	</ui:define>
</ui:composition>